from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By
from test_data.tupiandata import tupian


class TouXiang:
    def __init__(self,driver):
        self.driver=driver
    def uplod_pic(self):
        sleep(2)
        self.driver.find_element(By.LINK_TEXT,'个人信息').click()
        sleep(2)
        self.driver.find_element(By.ID,'preview').click()
        sleep(1)
        frame=self.driver.find_element(By.TAG_NAME,'iframe')
        self.driver.switch_to.frame(frame)
        self.driver.find_element(By.NAME,'file').send_keys(tupian)
        self.driver.find_element(By.CLASS_NAME,'saveBtn').click()
        self.driver.switch_to.default_content()
        self.driver.find_element(By.CSS_SELECTOR,'[type="submit"]').click()
